package com.int_tech.newTimeTask;

import com.int_tech.MessageCodeAll.dao.CodeA0Dao;
import com.int_tech.MessageCodeAll.dao.CodeA2Dao;
import com.int_tech.MessageCodeAll.dao.CodeA4Dao;
import com.int_tech.MessageCodeAll.entity.CodeA0;
import com.int_tech.MessageCodeAll.entity.CodeA2;
import com.int_tech.MessageCodeAll.entity.CodeA4;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.ParseException;
import java.util.List;

/**
 * Created by liubochao on 2018/6/23.
 */
@Component
public class A0A2A4DeleteLngLatIs0TimeTask {

    @Autowired
    private CodeA0Dao codeA0Dao;

    @Autowired
    private CodeA2Dao codeA2Dao;

    @Autowired
    private CodeA4Dao codeA4Dao;


    @Scheduled(cron="0/10 * * * * ?")
    public void checkA0A2A4Delete() throws ParseException {

        String lat = "0.0";

        //删除所有坐标为0的数据
        List<CodeA0> codeA0List = codeA0Dao.findByLatAndStatus(lat,0);
        codeA0Dao.deleteInBatch(codeA0List);

        List<CodeA2> codeA2list = codeA2Dao.findByLatAndStatus(lat,0);
        codeA2Dao.deleteInBatch(codeA2list);

        List<CodeA4> codeA4List = codeA4Dao.findByLatAndStatus(lat,0);
        codeA4Dao.deleteInBatch(codeA4List);

    }

}
